import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.*;

/**
 * This class represents a MessageBox.
 * <br /><br />
 * It is responsible for providing a graphical Frame and draw any given Message.
 * 
 * @author (Dilyan GEORGIEV)
 * @author (Thomas KOBER)
 * @author (Matthew MCDONALD)
 * 
 * @version (1.0)
 */
public class MessageBox extends Actor
{
    ////////////////////////////////////////////////////////////////////////////////
    // Public Implementation
    ////////////////////////////////////////////////////////////////////////////////
    
    /**
     * Draws the given Message on the MessageBox.
     * @param contents ArrayList holding the contents of the Message to be drawn.
     */
    public void drawMessage(ArrayList<Message> contents)
    {
        GreenfootImage image = super.getImage();
       
        for (Message msg : contents) {
            image.setFont(msg.getFont());
            image.setColor(msg.getTextColor());
            
            image.drawString(msg.getText(), (int)msg.getPosition().getX(), (int)msg.getPosition().getY());
        }
    }
    
    /**
     * Act - do whatever the Arrow wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {}
}
